var core    = require("core")
,   db      = core.db
,   schema  = db.schema
,   step    = core.step;

var link = function(example){

    var app = global.app;

    schema.User.count(function(err, count){
        app.user = {
            count : (err || true) && count
        };
    });

    schema.Platform.find({}, "-_id -__v", function(err, docs){
        if(err)
            return;
        app.platform = {
            count : docs.length,
            item  : {}
        };

        for(var i = 0; i < docs.length; i++){
            var pid = docs[i].platformId;
            app.platform.item[pid] = docs[i];
        };
    });

};

module.exports = link;
